<%@ page language="java" pageEncoding="utf-8" %>


<table width="800" width="80%" align="center">
    <tr>
        <td>
            <div align="center">
                <br><%@include file="../top.jsp" %><br>
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <div align="center">
                <table width="100%">
                    <s:if test="#session.loginState != 1">
                        您还没有登录，请 <a href="<%=path%>/login/login.jsp">登录 </a>!
                    </s:if>
                    <s:else>
                        <tr>
                            <td colspan="7">购书车</td>
                        </tr>
                        <tr>
                            <td colspan="7">
                                <hr size="1" noshade width="100%">
                            </td>
                        </tr>
                        <tr>
                            <td>书号</td>
                            <td>书名</td>
                            <td>出版社</td>
                            <td>单价</td>
                            <td>数量（本）</td>
                            <td>合价</td>
                            <td>操作</td>
                        </tr>
                        <s:iterator value="#session.cart_items" var="order">
                            <tr>
                                <td><s:property value="#order.bookid"/></td>
                                <td><s:property value="#order.bookname"/></td>
                                <td><s:property value="#order.publisher"/></td>
                                <td>￥<s:property value="#order.unitprice"/></td>
                                <td>
                                    <form
                                            action="<%=path%>/order/OrdersAction_increCartItemAmount.action?&bookid=
                                            <s:property value="#order.bookid"/>"
                                            method="post">
                                        <br> <input type="submit" name="+" value="+">
                                        <s:property value="#order.ordernum"/>
                                        <input type="submit" name="-" value="-">
                                    </form>
                                </td>
                                <td>
                                    <script type="text/javascript">
                                        document.write("￥" + <s:property value="#order.ordernum"/>  *
                                                <s:property value="#order.unitprice"/>)
                                    </script>
                                </td>
                                <td>
                                    <a href="<%=path %>/order/OrderAction_deleteCartItem.action?userid=
                                    <s:property value="#session.loginUserid"/>&bookid=<s:property value="#order.bookid"/>">取消</a>
                                </td>
                            </tr>
                        </s:iterator>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>
                                <script type="text/javascript">
                                    var totalNum = 0;
                                    <s:iterator value="#session.cart_items" var="order">
                                    totalNum += <s:property value="#order.ordernum"/>
                                            </s:iterator>
                                    document.write("合计：" + totalNum + " 本")
                                </script>
                            </td>
                            <td>
                                <script type="text/javascript">
                                    var totalAccount = 0.00;
                                    <s:iterator value="#session.cart_items" var="order">
                                            totalAccount +=
                                    <s:property value="#order.ordernum"/> * <s:property value="#order.unitprice"/>
                                    </s:iterator>
                                    document.write("总价：￥" + totalAccount)
                                </script>
                            </td>
                            <td></td>

                        </tr>
                        <tr>
                            <td colspan="7">
                                <div align="center">

                                    <a href="<%=path%>/order/OrdersAction_clearCart.action"> <input
                                            type="button" value="清空购书车 ">
                                    </a> <a href="<%=path%>/order/order1.jsp"><input type="button"
                                                                                     value="去收银台 "></a>
                                </div>
                            </td>
                        </tr>
                    </s:else>
                </table>
            </div>
        </td>
    </tr>

    <tr>
        <td>
            <div align="center">
                <br><%@include file="/bottom.jsp"%>
            </div>
        </td>
    </tr>
</table>

